package com.cam.framework.system.dept.mapstruct;

import com.cam.framework.system.dept.domain.SysDeptDTO;
import com.cam.framework.system.dept.entity.SysDept;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

@Mapper(componentModel = "spring")
public interface SysDeptMapStruct {

    @Mappings({
            @Mapping(source = "parentId", target = "parent.id"),
            @Mapping(source = "createBy", target = "createBy.id"),
            @Mapping(source = "updateBy", target = "updateBy.id")
    })
    SysDeptDTO toDTO(SysDept entity);

    @Mappings({
            @Mapping(source = "parent.id", target = "parentId"),
            @Mapping(source = "createBy.id", target = "createBy"),
            @Mapping(source = "updateBy.id", target = "updateBy")
    })
    SysDept toEntity(SysDeptDTO dto);


}
